<template>
	<view class="wrap">
		<u-navbar :title="$t('clkt')" title-width="340" :border-bottom="false" back-icon-color="#fff" title-color="#fff" :background="{ backgroundColor: '#0030A8' }"></u-navbar>
		<view class="tom-container">
			<view class="list">
				<view class="nr_item" style="align-items: flex-start;margin-top: 10px;">
					<view class="nr_item_left">{{$t('jys')}}：</view>
					<view class="nr_item_right">
						<view class="select_for" @tap="Select_Ro2">
							{{ list2[list2_index].label }}
							<u-icon name="you" custom-prefix="custom-icon" size="20"></u-icon>
						</view>
					</view>
				</view>
				<view class="nr_item">
					<view class="nr_item_left">{{$t('bizhong')}}：</view>
					<view class="nr_item_right">
						<view class="select_for" @tap="Select_Ro5">
							{{ exchangeCoins_text != -1 ? exchangeCoins[exchangeCoins_text].label :$t('qxzbz')}}
							<u-icon name="you" custom-prefix="custom-icon" size="20"></u-icon>
						</view>
					</view>
				</view>
				<view class="nr_item">
					<view class="nr_item_left">{{$t('xhfs')}}：</view>
					<view class="nr_item_right">
						<view class="select_for" @tap="Select_Ro4">
							{{ tacticsType[tacticsType_index].label }}
							<u-icon name="you" custom-prefix="custom-icon" size="20"></u-icon>
						</view>
					</view>
				</view>
				<view class="nr_item">
					<view class="nr_item_left">{{$t('zye')}}：</view>
					<view class="nr_item_right">
						<view class="exchange_Balance">
							{{ new_data[list2_index].exchangeBalance }}
							<text class="text">USDT</text>
						</view>
					</view>
				</view>
				<view class="nr_item">
					<view class="nr_item_left">{{$t('clky')}}：</view>
					<view class="nr_item_right">
						<view class="exchange_Balance">
							{{ new_data[list2_index].useableBalance }}
							<text class="text">USDT</text>
						</view>
					</view>
				</view>
				<view class="nr_item nr_item_border" style="align-items: flex-start;">
					<view class="nr_item_left">{{$t('jycl')}}：</view>
					<view class="nr_item_right">
						<view class="strategy">
							<view class="strategy-item" @tap="switchStrategy(index)" v-for="(item, index) in strategyList" :key="index" :class="{ active: strategy == index }">
								{{ item.label }}
							</view>
							<view class="strategy-item" @tap="switchStrategy(2)" :class="{ active: strategy == 2 }" v-if="pageData.allowRiskControl">
								{{$t('fkbs')}}
								<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips2(1)"></u-icon>
							</view>
							<view class="strategy-item" @tap="switchStrategy(3)" :class="{ active: strategy == 3 }" v-if="pageData.allowRiskControl" style="margin-top: 10rpx;">
								{{$t('fkjj')}}
								<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips2(2)"></u-icon>
							</view>
						</view>
					</view>
				</view>
				<view class="nr_item nr_item_border" style="align-items:flex-start;">
					<view class="nr_item_left">{{$t('zdhc')}}：</view>
					<view class="nr_item_right">
						<view class="limit">
							<input class="limit-input" type="digit" v-model="form.stopLoss" :placeholder="$t('qsrzdhc')" maxlength="10" @blur="inputStopLoss" />
							<text class="limit-text">{{ $BigNumber(form.stopLoss || 0).multipliedBy(100) }}%</text>
							<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips3()"></u-icon>
						</view>
						<view class="Opening_amount" v-if="Number(form.stopLoss) > pageData.stopLossRange[1]">{{$t('zdhc')}}{{ pageData.stopLossRange[1] }}</view>
						<view class="Opening_amount" v-if="Number(form.stopLoss) < pageData.stopLossRange[0]">{{$t('zxhc')}}{{ pageData.stopLossRange[0] }}</view>
					</view>
				</view>
				<view v-if="clshow == true">
					<view class="nr_item nr_item_border" style="align-items:flex-start;">
							<view class="nr_item_left">{{$t('sdje')}}：</view>
							<view class="nr_item_right">
								<view class="limit">
									<input class="limit-input" type="digit" v-model="firstAmount" @input="changeFirst" :placeholder="$t('srnr')" maxlength="10" @blur="inputTransferAmount" />
									<text class="limit-text">USDT</text>
									<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips4()"></u-icon>
								</view>
								<view class="Opening_amount" v-if="Number(form.transferAmount) < Number(pageData.transferAmountMin)">
									{{$t('yljezdsz')}}{{ pageData.transferAmountMin }}U
								</view>
							</view>
						</view>
						<view class="nr_item nr_item_border" style="align-items:flex-start;">
							<view class="nr_item_left">{{$t('bccs')}}：</view>
							<view class="nr_item_right">
								<view class="limit">
									<u-number-box @change="changeCishu" :min="1" :max="7" v-model="patchTimes"></u-number-box>
									<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips5()"></u-icon>
								</view>
							</view>
						</view>
					<view class="nr_item nr_item_border" style="align-items:flex-start;">
						<view class="nr_item_left">{{$t('bcjg')}}：</view>
						<view class="nr_item_right">
							<view class="limit">
								<input class="limit-input" type="digit" v-model="patchRatio" :placeholder="$t('srnr')" maxlength="10" @blur="inputTransferAmount" />
								<text class="limit-text">{{ $BigNumber(patchRatio || 0).multipliedBy(100) }}%</text>
								<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips6()"></u-icon>
							</view>
						</view>
					</view>
					<view class="nr_item">
						<view class="nr_item_left">{{$t('ggbs')}}：</view>
						<view class="nr_item_right">
							<view class="exchange_Balance">
								{{ new_data[list2_index].leverage }}
								<text class="text">{{$t('bei')}}</text>
							</view>
						</view>
					</view>
					<view class="nr_item">
						<view class="nr_item_left">{{$t('mczdbzj')}}：</view>
						<view class="nr_item_right">
							<view class="exchange_Balance" style="color:red;" v-if="new_data[list2_index].useableBalance < zdbzj2">
								{{ zdbzj2 }}
								<text class="text">USDT</text>
							</view>
							<view class="exchange_Balance"  v-else>
								{{ zdbzj2 }}
								<text class="text">USDT</text>
							</view>
						</view>
					</view>
				</view>
				<view v-else>
					<view class="nr_item nr_item_border" style="align-items:flex-start;">
							<view class="nr_item_left">{{$t('sdje')}}：</view>
							<view class="nr_item_right">
								<view class="limit">
									<input class="limit-input" style="border:1px #ccc solid;color:#ccc;" type="digit" disabled v-model="new_data[list2_index].defFirstAmount" :placeholder="$t('srnr')" maxlength="10" @blur="inputTransferAmount" />
									<text class="limit-text">USDT</text>
									<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips4()"></u-icon>
								</view>
								<view class="Opening_amount" v-if="Number(form.transferAmount) < Number(pageData.transferAmountMin)">
									{{$t('yljezdsz')}}{{ pageData.transferAmountMin }}U
								</view>
							</view>
						</view>
						<view class="nr_item nr_item_border" style="align-items:flex-start;">
							<view class="nr_item_left">{{$t('bccs')}}：</view>
							<view class="nr_item_right">
								<view class="limit">
									<u-number-box :min="1" :max="7" disabled v-model="new_data[list2_index].defPatchTimes"></u-number-box>
									<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips5()"></u-icon>
								</view>
							</view>
						</view>
					<view class="nr_item nr_item_border" style="align-items:flex-start;">
						<view class="nr_item_left">{{$t('bcjg')}}：</view>
						<view class="nr_item_right">
							<view class="limit">
								<input disabled class="limit-input" style="border:1px #ccc solid;color:#ccc;" type="digit" v-model="new_data[list2_index].defPatchRatio" :placeholder="$t('srnr')" maxlength="10" @blur="inputTransferAmount" />
								<text class="limit-text">{{ $BigNumber(new_data[list2_index].defPatchRatio || 0).multipliedBy(100) }}%</text>
								<u-icon name="wenhao" custom-prefix="custom-icon" size="30" style="margin-left: 16rpx;" @tap="Strategy_tips6()"></u-icon>
							</view>
						</view>
					</view>
					<view class="nr_item">
						<view class="nr_item_left">{{$t('ggbs')}}：</view>
						<view class="nr_item_right">
							<view class="exchange_Balance">
								{{ new_data[list2_index].leverage }}
								<text class="text">{{$t('bei')}}</text>
							</view>
						</view>
					</view>
					<view class="nr_item">
						<view class="nr_item_left">{{$t('mczdbzj')}}：</view>
						<view class="nr_item_right">
							<view class="exchange_Balance" style="color:red;" v-if="new_data[list2_index].useableBalance < zdbzj">
								{{ zdbzj }}
								<text class="text">USDT</text>
							</view>
							<view class="exchange_Balance"  v-else>
								{{ zdbzj }}
								<text class="text">USDT</text>
							</view>
						</view>
					</view>
				</view>
			
				<view class="RobotShock_tips">
					<view class="title">{{$t('ktxz')}}</view>
					<view class="text"><rich-text :nodes="strings"></rich-text></view>
				</view>
				<view class="btn_success" @tap="btn_ok"><text class="text">{{$t('qdkt')}}</text></view>
			</view>
		</view>
		<u-select :cancelText="$t('quxiao')" :confirmText="$t('queren')" v-model="show2" :default-value="[list2_index || 0]" mode="single-column" :list="list2" @confirm="picker_confirm2"></u-select>
		<u-select :cancelText="$t('quxiao')" :confirmText="$t('queren')" v-model="show3" :default-value="[contractType_index || 0]" mode="single-column" :list="contractType" @confirm="picker_confirm3"></u-select>
		<u-select :cancelText="$t('quxiao')" :confirmText="$t('queren')" v-model="show4" :default-value="[tacticsType_index || 0]" mode="single-column" :list="tacticsType" @confirm="picker_confirm4"></u-select>
		<u-select :cancelText="$t('quxiao')" :confirmText="$t('queren')" v-model="show5" :default-value="[exchangeCoins_text > 0 ? exchangeCoins_text : 0]" mode="single-column" :list="exchangeCoins" @confirm="picker_confirm5"></u-select>
		<u-select :cancelText="$t('quxiao')" :confirmText="$t('queren')" v-model="show6" :default-value="[exchangeCoins_text2 > 0 ? exchangeCoins_text2 : 0]" mode="single-column" :list="exchangeCoins2" @confirm="picker_confirm6"></u-select>
		<u-toast ref="uToast" />
		<tom-pwd v-if="showPwd" @cancel="showPwd = false" @confirm="confirm"></tom-pwd>
		<u-popup v-model="show" mode="center" class="popup" z-index="5">
			<view class="pop_nr">
				<view class="text2">{{$t('ktts')}}</view>
				<view class="text">{{$t('gceqc')}}</view>
				<view class="btn" @tap="show = false">{{$t('haode')}}</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			clshow:false,
			zdbzj:0,
			zdbzj2:0,
			list2_index:0,
			firstAmount:'',
			patchTimes:'1',
			patchRatio:'',
			list2: [
				{
					value: '1',
					label: this.$t('bajys')
				},
				{
					value: '2',
					label: this.$t('oyjys')
				}
			],
			contractType: [
				/*合约类型*/
				{
					value: '',
					label: ''
				}
			],
			tacticsType: [
				/*循环方式*/
				{
					value: '',
					label: ''
				}
			],
			exchangeCoins: [
				{
					value: '',
					label: ''
				},
				{
					value: '',
					label: ''
				}
			],
			exchangeCoins2: [
				{
					value: '',
					label: ''
				}
			],
			exchangeCoins_text: -1,
			exchangeCoins_text2: -1,
			exchangeCoins_index: 0,
			contractType_index: 0,
			tacticsType_index: 0,
			show: false,
			show2: false,
			show3: false,
			show4: false,
			show5: false,
			show6: false,
			form: {
				stopLoss: '' /*最大回撤*/,
				transferAmount: '' /*划转现货*/
			},
			showPwd: false /*密码输入状态*/,
			// 策略选择列表
			strategyList: [{ label: this.$t('tyx'), value: 'SHOCK_STEADY',value2: 'STEADY'}, { label: this.$t('zdy'), value: 'SHOCK_RADICAL',value2: 'RADICAL' }],
			strategyList2: /*做过虑用的*/[{ label: this.$t('bsx'), value: 'SHOCK_STEADY',value2: 'STEADY'},
			{ label: this.$t('jjx'), value: 'SHOCK_RADICAL',value2: 'RADICAL' },
			{ label: this.$t('fxkzbsx'), value2: 'RISK_CONTROL_STEADY' },
			{ label: this.$t('fxkzjjx'), value2: 'RISK_CONTROL_RADICAL' },
			],
			// 选中策略索引
			strategy: 0,
			pageData: { stopLossRange: [0, 0],contractPageList:[{exchangeBalance:'',leverage:''}] },
			strings: '' /*开通须知*/,
			leverage: '', /*,杠杆倍数*/
			IncomePredict:0,/*收益测算*/
			IncomePredict2:0,/*收益测算*/
			
			new_data:[
				{exchangeBalance:'',leverage:''}
			]
			
		};
	},
	onShow() {
		this.indexData();
	},
	mounted() {
		this.show = true;
	},
	methods: {
		changeFirst(e){
			this.countBzj2()
		},
		changeCishu(e){
			this.countBzj2()
		},
		countBzj(){
			let sdje = this.new_data[this.list2_index].defFirstAmount
			let bccs = this.new_data[this.list2_index].defPatchTimes
			let bzjz = 0
			for(var i=0;i<bccs;i++){
				bzjz += sdje*Math.pow(2,i)
			}
			this.zdbzj = bzjz/20
		},
		countBzj2(){
			let sdje = this.firstAmount||0
			let bccs = this.patchTimes||0
			let bzjz = 0
			for(var i=0;i<bccs;i++){
				bzjz += sdje*Math.pow(2,i)
			}
			this.zdbzj2 = bzjz/20
		},
		change_data(index){
			index = index || 0;
			let coins = [];
			this.new_data[index].exchangeCoinList.forEach((v,i)=>{
				coins.push({
					label:this.new_data[index].exchangeCoinList[i].exchangeCoinShow,
					value:i
				});
			});
			this.exchangeCoins = this.exchangeCoins2 = coins;
			var arr2 = [];
			var arr3 = [];
			this.new_data[index].contractType.forEach(function(item) {
				arr2.push({ value: index, label: item });
			});
			this.new_data[index].tacticsType.forEach(function(item, index) {
				arr3.push({ value: index, label: item });
			});
			this.contractType = arr2;
			this.tacticsType = arr3;
			this.exchangeCoins_text = -1;
			this.exchangeCoins_text2 = -1;
			this.IncomePredict = 0;
			this.IncomePredict2 = 0;
			this.contractType_index = 0;
			this.tacticsType_index = 0;
		},
		indexData() {
			uni.showLoading({
				mask: true,
				title: this.$t('loading.title')
			});
			this.$api.consoleApi
				.shock_getContractRobotOpenPage()
				.then(res => {
					// this.list2 = res.data.exchangeList;
					this.pageData = res.data;
					// this.leverage = res.data.leverage;
					this.form.stopLoss = res.data.stopLossRange[1];
					this.form.transferAmount = res.data.transferAmountMin;
					// this.exchangeCoins = res.data.exchangeCoins;
					// this.exchangeCoins2 = res.data.exchangeCoins;
					this.strings = res.data.notice;
					// var arr2 = [];
					// var arr3 = [];
					// res.data.contractType.forEach(function(item) {
					// 	arr2.push({ value: item, label: item });
					// });
					// res.data.tacticsType.forEach(function(item, index) {
					// 	arr3.push({ value: index, label: item });
					// });
					// this.contractType = arr2;
					// this.tacticsType = arr3;
					
					this.new_data = res.data.contractPageList;
					let arr = [];
					this.new_data.forEach((v,i)=>{
						arr.push({
							label:this.new_data[i].exchangeNameShow,
							name:this.new_data[i].exchangeName,
							value:i
						});
					});
					this.list2 = arr;
					this.list2_index = 0;
					this.countBzj()
					this.change_data();
					
					// this.get_IncomePredict();
					// this.get_IncomePredict2();
					uni.hideLoading();
				})
				.catch(res => {
					uni.hideLoading();
				});
		},
		Select_Ro2(e) {
			this.show2 = true;
		},
		Select_Ro3(e) {
			this.show3 = true;
		},
		Select_Ro4(e) {
			this.show4 = true;
		},
		Select_Ro5(e) {
			this.show5 = true;
		},
		Select_Ro6(e) {
			this.show6 = true;
		},
		picker_confirm2(e) {
			this.list2_index = e[0].value;
			this.change_data(this.list2_index);
			this.countBzj()
			this.countBzj2()
		},
		picker_confirm3(e) {
			console.log(e);
			this.contractType_index = e[0].value;
		},
		picker_confirm4(e) {
			this.tacticsType_index = e[0].value;
		},
		picker_confirm5(e) {
			console.log(e);
			this.exchangeCoins_text = e[0].value;
			this.get_IncomePredict();
			
		},
		picker_confirm6(e) {
			this.exchangeCoins_text2 = e[0].value;
			this.get_IncomePredict2();
		},
		get_IncomePredict(){
			this.$api.consoleApi
				.getIncomePredict({
					exchangeName:this.new_data[this.list2_index].exchangeName,
					exchangeCoin:this.exchangeCoins[this.exchangeCoins_text].label,
					dangerType:this.strategyList[this.strategy].value2,
				})
				.then(res => {
					this.IncomePredict = res.data;
				})
		},
		get_IncomePredict2(){
			this.$api.consoleApi
				.getIncomePredict({
					exchangeName:this.new_data[this.list2_index].exchangeName,
					exchangeCoin:this.exchangeCoins[this.exchangeCoins_text2].label,
					dangerType:this.strategyList[this.strategy].value2,
				})
				.then(res => {
					this.IncomePredict2 = res.data;
				})
		},
		inputStopLoss() {
			/*回撤验证*/
			if (Number(this.form.stopLoss) < Number(this.pageData.stopLossRange[0])) {
				this.$nextTick(() => {
					this.form.stopLoss = Number(this.pageData.stopLossRange[1]);
					this.$utils.toast(this.$t('zxhc')+`${this.pageData.stopLossRange[0]}`);
				});
			}
			if (Number(this.form.stopLoss) > Number(this.pageData.stopLossRange[1])) {
				this.$nextTick(() => {
					this.form.stopLoss = Number(this.pageData.stopLossRange[1]);
					this.$utils.toast(this.$t('zdhc')+`${this.pageData.stopLossRange[1]}`);
				});
			}
		},
		inputTransferAmount() {
			/*划转现货验证*/
			if (Number(this.form.transferAmount) < this.pageData.transferAmountMin) {
				this.$nextTick(() => {
					this.form.transferAmount = this.pageData.transferAmountMin;
					this.$utils.toast(this.$t('yljezdsz')+`${this.pageData.transferAmountMin}U`);
				});
			}
		},
		switchStrategy(i) {
			/*切换策略*/
			var that = this;
			if (that.strategy == i) return;
			that.strategy = i;
			if(i == 0){
				this.clshow = false
			}
			if(i == 1){
				this.clshow = true
			}
			if(this.exchangeCoins[this.exchangeCoins_text] && this.strategy < 2){
				that.get_IncomePredict();
			}
			
			if(this.exchangeCoins[this.exchangeCoins_text2] && this.strategy < 2){
				that.get_IncomePredict2();
			}
			
		},
		Strategy_tips(e) {
			/*策略详情*/
			this.$refs.uToast.show({
				title: e == 0? this.$t('zdkt7'):this.$t('jjkt6'),
				type: 'warning',
				duration: 3000,
				icon: false
			});
		},
		Strategy_tips2(e) {
			/*策略详情*/
			this.$refs.uToast.show({
				title: e == 1? this.$t('fxkzwu'):this.$t('fxjjwu'),
				type: 'warning',
				duration: 3000,
				icon: false
			});
		},
		Strategy_tips3() {
			/*策略详情*/
			this.$refs.uToast.show({
				title: this.$t('huicetips'),
				type: 'warning',
				duration: 3000,
				icon: false
			});
		},
		Strategy_tips4() {
			/*策略详情*/
			this.$refs.uToast.show({
				title: this.$t('sdtips'),
				type: 'warning',
				duration: 3000,
				icon: false
			});
		},
		Strategy_tips5() {
			/*策略详情*/
			this.$refs.uToast.show({
				title: this.$t('bctips'),
				type: 'warning',
				duration: 3000,
				icon: false
			});
		},
		Strategy_tips6() {
			/*策略详情*/
			this.$refs.uToast.show({
				title: this.$t('jgtips'),
				type: 'warning',
				duration: 3000,
				icon: false
			});
		},
		btn_ok() {
			/*开通验证*/
			if (Number(this.form.stopLoss) < Number(this.pageData.stopLossRange[0])) return this.$utils.toast(this.$t('zxhc')+`${this.pageData.stopLossRange[0]}`);
			if (Number(this.form.stopLoss) > Number(this.pageData.stopLossRange[1])) return this.$utils.toast(this.$t('zdhc')+`${this.pageData.stopLossRange[1]}`);
			if (Number(this.form.transferAmount) < this.pageData.transferAmountMin) return this.$utils.toast(this.$t('yljezdsz')+`${this.pageData.transferAmountMin}U`);
			if (this.exchangeCoins_text == -1 && this.strategy < 2) return this.$utils.toast(this.$t('qxzbz'));
			console.log(this.tacticsType[this.tacticsType_index].label); //循环方式
			if(this.clshow){
				if(!this.firstAmount){
					return this.$utils.toast(this.$t('sdjebnwk'));
				}
				if(!this.patchRatio){
					return this.$utils.toast(this.$t('bcjgbnwk'));
				}
				if(this.new_data[this.list2_index].useableBalance < this.zdbzj2){
					return this.$utils.toast(this.$t('bzjbndyky'));
				}
			}else{
				if(this.new_data[this.list2_index].useableBalance < this.zdbzj){
					return this.$utils.toast(this.$t('bzjbndyky'));
				}
			}
			this.showPwd = true;
		},
		confirm(e) {
			this.showPwd = false;
			uni.showLoading({
				mask: true,
				title: this.$t('zztj')
			});
			/*运行机器人接口*/
			var form ={};
			let coin1_value = '';
			this.new_data[this.list2_index].exchangeCoinList.forEach((v,i)=>{
							if(this.new_data[this.list2_index].exchangeCoinList[i].exchangeCoinShow == this.exchangeCoins[this.exchangeCoins_text].label){
								coin1_value = this.new_data[this.list2_index].exchangeCoinList[i].exchangeCoinValue;
							}
						});
			this.$api.consoleApi
				.shock_saveContractRobotOpen({
					
					exchange_name:this.new_data[this.list2_index].exchangeName, //交易所
					exchange_coin_str:coin1_value, //币种拼接
					tactics_type:this.tacticsType[this.tacticsType_index].label, //循环方式
					tactics_parameter_type:this.clshow?1:0,
					transferPassword: e,
					contractType: 'SINGLECURRENCY',
					exchangeName: 'BINANCE',
					riskType:this.strategyList2[this.strategy].value2,/*策略类型保守型:SHOCK_STEADY,激进型:SHOCK_RADICAL*/
					leverage: this.leverage, //杠杆倍数
					stopLoss: this.form.stopLoss, //回撤比例
					transferAmount: this.form.transferAmount, //回撤比例
					tacticsType: this.tacticsType_index ? '1' : '2', //循环类型，1单次 2循环
					assetType: this.new_data[this.list2_index].exchangeBalance, //传账户余额
					firstAmount:this.firstAmount,
					patchTimes:this.patchTimes,
					patchRatio:this.patchRatio,
					margin:this.new_data[this.list2_index].exchangeBalance,
					...form,
				})
				.then(res => {
					this.indexData();
					this.$utils.toast(this.$t('czcg'));
					uni.hideLoading();
				})
				.catch(res => {
					uni.hideLoading();
				});
		}
	}
};
</script>

<style lang="scss" scoped>
.tom-container {
	padding-top: 50rpx;
}
.list {
	flex: 1;
	border-radius: 50rpx 50rpx 0rpx 0rpx;
	overflow: auto;
	background-color: #fff;
	.nr_top {
		padding: $nr-padd;
		border: 2rpx solid $page-bg;
		.right {
			width: 100%;
			.right_xin {
				display: flex;
				justify-content: space-between;
				.right_xin_left {
					color: $tom-text-color;
					font-size: 28rpx;
					font-weight: bold;
				}
				.right_xin_right {
					color: $tom-text-sub-color2;
					display: flex;
					.label {
						font-size: 28rpx;
						margin-right: 20rpx;
					}
					.u-icon {
						transform: rotate(90deg);
					}
				}
			}
		}
	}
	.nr_item {
		padding: 20rpx $nr-padd;
		display: flex;
		align-items: center;
		.nr_item_left {
			white-space: nowrap;
			font-weight: bold;
			font-size: 28rpx;
		}
		.nr_item_right {
			.strategy {
				display: flex;
				flex-wrap: wrap;
				.strategy-item {
					color: $tom-text-sub-color;
					font-size: 28rpx;
					margin: 0px 20rpx;
				}
				.active {
					color: #FFFFFF;
					background-color: $text-color;
					padding: 2px 8px;
					font-size: 13px;
					border-radius: 2px;
				}
				.strategy-item_plus {
					border: 2rpx solid $text-color;
					padding: 6rpx 20rpx;
					margin-top: -8rpx;
				}
			}
			.select_for {
				display: flex;
				align-items: center;
				font-size: 28rpx;
				.u-icon {
					transform: rotate(90deg);
					margin-left: 10rpx;
				}
			}
			.exchange_Balance {
				color: $text-color;
				font-size: 28rpx;
				font-weight: bold;
				.text {
					margin-left: 10rpx;
					color: $tom-text-color;
					font-weight: 400;
				}
			}
			.Opening_amount {
				font-size: 24rpx;
				color: $text-color;
				margin-top: 10rpx;
			}
			.limit {
				display: flex;
				align-items: center;
				&-input {
					width: 240rpx;
					height: 50rpx;
					border: 1px solid $tom-text-sub-color;
					border-radius: 4rpx;
					color: $text-color;
					font-size: 24rpx;
					padding: 0 20rpx;
					box-sizing: border-box;
				}
				&-text {
					margin-left: 20rpx;
					color: $tom-text-color;
					font-size: 24rpx;
				}
				.buyin-plusreduce {
					margin-left: 30rpx;
					width: 104rpx;
					height: 40rpx;
					padding: 0 10rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					border: 1px solid $text-color;
					border-radius: 8rpx;
					.buyin-plusreduce-line {
						width: 1px;
						height: 20rpx;
						background-color: #2a405c;
					}
				}
			}
		}
	}
	.nr_item_border {
		border: none;
	}
	.btn_success {
		width: 440rpx;
		height: 80rpx;
		background-color: $text-color;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 10rpx;
		margin: 50rpx auto;
		.text {
			font-size: 32rpx;
			font-weight: bold;
		}
	}
}
.RobotShock_tips {
	padding: $nr-padd;
	.title {
		font-size: 32rpx;
		color: $tom-text-color;
		font-weight: bold;
		margin-bottom: 20rpx;
	}
	.text {
	}
}
.popup {
	.pop_nr {
		display: inline-block;
		width: 598rpx;
		height: 761rpx;
		background-image: url('/static/new_images/RobotShockbg.png');
		background-size: 100% 100%;
		padding-top: 330rpx;
		padding-right: 90rpx;
		padding-bottom: 0rpx;
		padding-left: 90rpx;
		box-sizing: border-box;
		position: relative;
		text-align: center;
		.text2 {
			font-size: 36rpx;
			font-weight: bold;
			color: #1E36B3;
			margin-bottom: 20rpx;
		}
		.text {
			color: #999;
			font-size: 28rpx;
		}
		.btn {
			width: 500rpx;
			line-height:80rpx;
			border-radius: 76rpx;
			position: absolute;
			bottom: 52rpx;
			left: 54rpx;
			background:#FFCA59;
			background:linear-gradient(to bottom,#F2C971 0%,#FFCA59 100%);
			color:#F04040;
			font-size:32rpx;
		}
	}
}

</style>
